#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cexapi
import datetime
import time
import re

credentialFile = open('credentials.txt', 'r+')

for line in credentialFile:
        resultLine = re.split(';', line)  
        if resultLine[0]=='hannesh':
            apiUser=resultLine[0]
            apiCred1=resultLine[1]
            apiCred2=resultLine[2]      

demo = cexapi.api(apiUser, apiCred1, apiCred2)


current_orders = demo.current_orders()

limit=0.0160

for order in current_orders:
    orderPrice=float(order['price'])
    if orderPrice>=limit:
        print order
        demo.cancel_order(order['id'])

